﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using DataAccessClasses;

namespace eschoolBO
{
    public class student
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _student_id = -99;
        private string _enrollment_no = "";
        private long _roll_no = -99;
        private long _class_id = -99;
        private string _year_of_studing = "";
        private string _student_name = "";
        private string _date_of_birth = "";
        private string _gender = "";
        private string _photo = "";
        //private long _parent_id = -99;
        private string _permanent_address = "";
        private long _residence_pno = -99;
        private long _mobile_no = -99;
        private string _student_emailid = "";
        private long _user_type_id = -99;
        private string _username = "";
        private string _password = "";
        private string _security_question = "";
        private string _answer = "";
        private bool _isdeleted = false;
        public long student_id
        {
            get
            {
                return _student_id;
            }
            set
            {
                _student_id = value;
            }
        }
        public string enrollment_no
        {
            get
            {
                return _enrollment_no;
            }
            set
            {
                _enrollment_no = value;
            }
        }
        public long roll_no
        {
            get
            {
                return _roll_no;
            }
            set
            {
                _roll_no = value;
            }
        }
        public long class_id
        {
            get
            {
                return _class_id;
            }
            set
            {
                _class_id = value;
            }
        }
        public string year_of_studing
        {
            get
            {
                return _year_of_studing;
            }
            set
            {
                _year_of_studing = value;
            }
        }
        public string student_name
        {
            get
            {
                return _student_name;
            }
            set
            {
                _student_name = value;
            }
        }
         public string date_of_birth
        {
            get
            {
                return _date_of_birth;
            }
            set
            {
                _date_of_birth = value;
            }
        }
         public string gender
        {
            get
            {
                return _gender;
            }
            set
            {
                _gender = value;
            }
        }
         public string photo
        {
            get
            {
                return _photo;
            }
            set
            {
                _photo = value;
            }
        }
        // public long parent_id
        //{
        //    get
        //    {
        //        return _parent_id;
        //    }
        //    set
        //    {
        //        _parent_id = value;
        //    }
        //}
         public string permanent_address
        {
            get
            {
                return _permanent_address;
            }
            set
            {
                _permanent_address = value;
            }
        }
         public long residence_pno
        {
            get
            {
                return _residence_pno;
            }
            set
            {
                _residence_pno = value;
            }
        }
         public long mobile_no
        {
            get
            {
                return _mobile_no;
            }
            set
            {
                _mobile_no = value;
            }
        }
         public string student_emailid
        {
            get
            {
                return _student_emailid;
            }
            set
            {
                _student_emailid = value;
            }
        }
        public long user_type_id
         {
            get
            {
                return _user_type_id;
            }
            set
            {
                _user_type_id = value;
            }
        }
        public string username
        {
            get
            {
                return _username;
            }
            set
            {
                _username = value;
            }
        }
        public string password
        {
            get
            {
                return _password;
            }
            set
            {
                _password = value;
            }
        }
        public string security_question
        {
            get
            {
                return _security_question;
            }
            set
            {
                _security_question = value;
            }
        }
        public string answer
        {
            get
            {
                return _answer;
            }
            set
            {
                _answer = value;
            }
        }
        public bool isdeleted
        {
            get
            {
                return _isdeleted;
            }
            set
            {
                _isdeleted = value;
            }
        }
        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@student_id", student_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@enrollment_no", enrollment_no, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@roll_no", roll_no, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@class_id", class_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@year_of_studing", year_of_studing, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@student_name", student_name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@date_of_birth", date_of_birth, DbType.AnsiString, ParameterDirection.Input); 
                DbParameter dbparam7 = DAC.Parameter("@gender", gender, DbType.AnsiString, ParameterDirection.Input); 
                DbParameter dbparam8 = DAC.Parameter("@photo", photo, DbType.AnsiString, ParameterDirection.Input);
                //DbParameter dbparam9 = DAC.Parameter("@parent_id", parent_id, DbType.Int64, ParameterDirection.Input); 
                DbParameter dbparam10 = DAC.Parameter("@permanent_address", permanent_address, DbType.AnsiString, ParameterDirection.Input); 
                DbParameter dbparam11= DAC.Parameter("@residence_pno", residence_pno, DbType.Int64, ParameterDirection.Input); 
                DbParameter dbparam12= DAC.Parameter("@mobile_no", mobile_no, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam13= DAC.Parameter("@student_emailid", student_emailid, DbType.AnsiString, ParameterDirection.Input); 
                //DbParameter dbparam14= DAC.Parameter("@registration_id", registration_id, DbType.Int64, ParameterDirection.Input); 
                DbParameter dbparam14= DAC.Parameter("@user_type_id", user_type_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam15 = DAC.Parameter("@username", username, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam16 = DAC.Parameter("@password", password, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam17 = DAC.Parameter("@security_question", security_question, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam18 = DAC.Parameter("@answer", answer, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam19= DAC.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4,dbparam5,dbparam6,dbparam7,dbparam8,dbparam10,dbparam11,dbparam12,dbparam13,dbparam14,dbparam15,dbparam16,dbparam17,dbparam18,dbparam19 };
                return DAC.Save("student_save", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords( long student_id,string enrollment_no,long roll_no ,long class_id,string year_of_studing ,string student_name ,string date_of_birth ,string gender,string photo,string permanent_address ,long residence_pno ,long mobile_no ,string student_emailid ,long user_type_id,string username,string password ,string security_question,string answer, bool isdeleted ,string paraandor)
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@student_id", student_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@enrollment_no", enrollment_no, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@roll_no", roll_no, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@class_id", class_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@year_of_studing", year_of_studing, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@student_name", student_name, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@date_of_birth", date_of_birth, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam7 = DAC.Parameter("@gender", gender, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam8 = DAC.Parameter("@photo", photo, DbType.AnsiString, ParameterDirection.Input);
                //DbParameter dbparam9 = DAC.Parameter("@parent_id", parent_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam10 = DAC.Parameter("@permanent_address", permanent_address, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam11 = DAC.Parameter("@residence_pno", residence_pno, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam12 = DAC.Parameter("@mobile_no", mobile_no, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam13 = DAC.Parameter("@student_emailid", student_emailid, DbType.AnsiString, ParameterDirection.Input);
                //DbParameter dbparam14 = DAC.Parameter("@registration_id", registration_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam14 = DAC.Parameter("@user_type_id", user_type_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam15 = DAC.Parameter("@username", username, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam16 = DAC.Parameter("@password", password, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam17 = DAC.Parameter("@security_question", security_question, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam18 = DAC.Parameter("@answer", answer, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam19 = DAC.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam20 = DAC.Parameter("@paraandor", paraandor, DbType.AnsiString, ParameterDirection.Input);
                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6, dbparam7, dbparam8, dbparam10, dbparam11, dbparam12, dbparam13,dbparam14, dbparam15, dbparam16,dbparam17,dbparam18,dbparam19,dbparam20};
                DataTable dt1 = DAC.Select("student_get", dbparamcall);
                return dt1;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }
    }
}
